package com.dreamcode.caloriestracker.utils;

class MathHeart{

    public MathHeart()
    {
    }

    public static int CalcHeartRateFromPercent(int i, int j, boolean flag, int k)
    {
        int l;
        if(flag)
            l = (int)((double)(i - j) * ((double)k / 100D) + (double)j);
        else
            l = (int)((double)i * ((double)k / 100D));
        return l;
    }

    public static int CalcHeartRateMaxFromAge(int i)
    {
        return 220 - i;
    }

    public static double CalcPercentFromHeartRate(int i, int j, boolean flag, int k)
    {
        double d = 0.0D;
        if(flag)
        {
            if(i - j != 0)
                d = (double)(k - j) / (double)(i - j);
        } else
        if(i != 0)
            d = (double)k / (double)i;
        return d * 100D;
    }

    public static String GetDiastolicClassificationTerm(int i)
    {
        String s = "";
        if(i < 85)
            s = "Normal";
        else
        if(i >= 85 && i <= 89)
            s = "High normal";
        else
        if(i >= 90 && i <= 99)
            s = "Mild hypertension";
        else
        if(i >= 100 && i <= 109)
            s = "Moderate hypertension";
        else
        if(i >= 110)
            s = "Severe hypertension";
        else
            System.exit(1);
        return s;
    }

    public static String GetHeartRateZoneTerm(int i)
    {
        String s = "";
        if(i <= 49)
            s = "No aerobic benefit";
        else
        if(i <= 59)
            s = "Minimal aerobic benefit";
        else
        if(i <= 84)
            s = "Exellent aerobic benefit";
        else
        if(i <= 94)
            s = "Upper exercise limit";
        else
            s = "Dangerous level";
        return s;
    }

    public static String GetSystolicClassificationTerm(int i)
    {
        String s = "";
        if(i < 130)
            s = "Normal";
        else
        if(i >= 130 && i <= 139)
            s = "High normal";
        else
        if(i >= 140 && i <= 159)
            s = "Mild hypertension";
        else
        if(i >= 160 && i <= 179)
            s = "Moderate hypertension";
        else
        if(i >= 180)
            s = "Severe hypertension";
        else
            System.exit(1);
        return s;
    }
}